import gui.MainWindow;

import java.awt.HeadlessException;
import java.io.IOException;
import java.sql.SQLException;

import org.xml.sax.SAXException;

import ctrl.DBAccess;
import ctrl.EVEAPICtrl;

public class MainProgram {

  /**
   * Main Method, currently used for testing purpose
   * 
   * @param args
   * @throws SAXException
   * @throws IOException
   */
  public static void main(String[] args) {
    int testProgram = 1;
    if (testProgram == 0) {
//    If there is no database, create one
      DBAccess dataBase = new DBAccess();
      dataBase._initializeDatabase();
    }
    else if (testProgram == 1) {
//      Normal use, load Database an load MarketData for items and systems
      try {
        MainWindow mainWindow = new MainWindow("EVE Trading Tool", false);
      }
      catch (HeadlessException | SAXException | SQLException | IOException e) {
        e.printStackTrace();
      }
    }
    else if (testProgram == 2) {
//      Debug use, load Database but do not load MarketData
      try {
        System.out.println("creating main program in debug mode");
        MainWindow mainWindow = new MainWindow("EVE Trading Tool", true);
        System.out.println("finished");
      }
      catch (HeadlessException | SAXException | SQLException | IOException e) {
        e.printStackTrace();
      }
    }
    else if (testProgram == 3) {
//      creates the connection to EVE API, is actually a completely different program ...
      EVEAPICtrl eveapictrl = new EVEAPICtrl();
    }
  }
}
